package com.eshop.dao.Impl;

import com.eshop.dao.CategoryDao;
import com.eshop.model.Category;

import java.util.List;

public class CategoryDaoImpl extends BaseDao implements CategoryDao {

    @Override
    public Category queryCategoryByCateId(int id) {
        String sql = "select * from t_category where cate_id = ?";
        return queryForOne(Category.class,sql,id);
    }

    @Override
    public List<Category> queryCategoryParent() {
        String sql = "select * from t_category where parentid is null";
        return queryForList(Category.class,sql);
    }

    @Override
    public List<Category> queryCategoryChildrenByParentId(int id) {
        String sql = "select * from t_category where parentid = ?";
        return queryForList(Category.class,sql,id);
    }
}
